/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.leospa.main;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Hashtable;

import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JRootPane;
import javax.swing.Timer;

import com.leospa.bean.Command_0;
import com.leospa.clients.SerialClient;
import com.leospa.properties.ColorPropertiesFile;
import com.leospa.properties.ConfigPropertiesFile;
import com.leospa.properties.ContentPropertiesFile;

/**
 *
 * @author ADMIN
 */
public class OptionScreen extends javax.swing.JFrame {

    /**
     * Creates new form Option1
     */
	 Hashtable<String , Command_0> command_0_hash ;
		MainScreen mainScreen;
		javax.swing.GroupLayout layout;
    public OptionScreen(MainScreen mainScreen, javax.swing.GroupLayout layout) {
    	this.layout = layout;
		this.mainScreen = mainScreen;
    	if(ConfigPropertiesFile.FULLSCREEN_MODE){
			setUndecorated(true);
			getRootPane().setWindowDecorationStyle(JRootPane.NONE);
		}
//    	try {
//			URL imgURL = new File( "./images/backgrond.png" ).toURI().toURL();
//			setContentPane(new JLabel(new ImageIcon(imgURL)));
//		} catch (MalformedURLException e) {
//			// TODO Auto-generated catch block
//			if(ConfigPropertiesFile.DEBUG_MODE_ON == true){
//		}
       initComponents();
       setResizable(false);//fixed frame size
       command_0_hash = Util.getUtilInstance().getCommand_0_hash();
       if(command_0_hash != null && command_0_hash.size() >0){
    	   for(int i = 0 ; i <command_0_hash.size() ;i++){
    		   if(i == 0 ){
    			   Command_0 command_0 = command_0_hash.get(""+(i+1));
    			   lblMassarium1.setText(command_0.getNAME());
    		   } else if(i == 1){
    			   Command_0 command_0 = command_0_hash.get(""+(i+1));
    			   lblMassarium2.setText(command_0.getNAME());
    		   } else if(i == 2){
    			   Command_0 command_0 = command_0_hash.get(""+(i+1));
    			   lblMassarium3.setText(command_0.getNAME());
    		   } else if(i == 3){
    			   Command_0 command_0 = command_0_hash.get(""+(i+1));
    			   lblMassarium4.setText(command_0.getNAME());
    		   }
    		   
    	   }    	   
    	   int dif = 4 -command_0_hash.size();
    	   if(dif == 0){
    		   jPanel2.setVisible(false);
    		   jPanel3.setVisible(false);
    		   jPanel4.setVisible(false);
    		   jPanel5.setVisible(false);
    	   } else if(dif == 1){    	   
    		   lblMassarium4.setVisible(false);
    		   btnFree4.setVisible(false);
    		   jPanel2.setVisible(false);
    		   jPanel3.setVisible(false);
    		   jPanel4.setVisible(false);
    		   jPanel5.setVisible(false);
    	   } else if(dif == 2){
    		   lblMassarium4.setVisible(false);
    		   btnFree4.setVisible(false);
    		   lblMassarium3.setVisible(false);
    		   btnFree3.setVisible(false);
    		   jPanel2.setVisible(false);
    		   jPanel3.setVisible(false);
    		   jPanel4.setVisible(false);
    		   jPanel5.setVisible(false);
    	   } else if(dif == 3){
    		   lblMassarium4.setVisible(false);
    		   btnFree4.setVisible(false);
    		   lblMassarium3.setVisible(false);
    		   btnFree3.setVisible(false);
    		   lblMassarium2.setVisible(false);
    		   jPanel2.setVisible(false);
    		   jPanel3.setVisible(false);
    		   jPanel4.setVisible(false);
    		   jPanel5.setVisible(false);
    		   btnFree2.setVisible(false);
    	   } else if(dif == 4){
    		   lblMassarium4.setVisible(false);
    		   btnFree4.setVisible(false);
    		   lblMassarium3.setVisible(false);
    		   btnFree3.setVisible(false);
    		   lblMassarium2.setVisible(false);
    		   btnFree2.setVisible(false);
    		   lblMassarium1.setVisible(false);
    		   btnFree1.setVisible(false);
    		   jPanel2.setVisible(false);
    		   jPanel3.setVisible(false);
    		   jPanel4.setVisible(false);
    		   jPanel5.setVisible(false);
    	   }
    	   
    	   for(int i = 0 ; i < command_0_hash.size();i++){
    		   Hashtable massHash = Util.getUtilInstance().getMassageTimerHash();
    		   Command_0 command_0 = command_0_hash.get(""+(i+1));    		  
    		   if(massHash.get(command_0.getSOLARIUMID()) != null){
    			   if(i == 0){
    	    		   btnFree1.setVisible(false);
    	    		   jPanel2.setVisible(true); 
    	    		   OptionMassageGuiHandler optionMassageGuiHandler = new OptionMassageGuiHandler(jPanel2, btnFree1, jLabel1,command_0,btnFree1);
    	    	   } else if(i == 1){
    	    		   btnFree2.setVisible(false);
    	    		   jPanel3.setVisible(true);
    	    		   OptionMassageGuiHandler optionMassageGuiHandler = new OptionMassageGuiHandler(jPanel3, btnFree2, jLabel2,command_0,btnFree2);
    	    	   } else if(i == 2){
    	    		   btnFree3.setVisible(false);
    	    		   jPanel4.setVisible(true);
    	    		   OptionMassageGuiHandler optionMassageGuiHandler = new OptionMassageGuiHandler( jPanel4, btnFree3, jLabel3,command_0,btnFree3);
    	    	   } else if(i == 3){
    	    		   btnFree4.setVisible(false);
    	    		   jPanel5.setVisible(true);
    	    		   OptionMassageGuiHandler optionMassageGuiHandler = new OptionMassageGuiHandler(jPanel5, btnFree4, jLabel4,command_0,btnFree4);
    	    	   }
    		   }    		   
    	   }    	   
       }             
        
       setTimer();
    }
    Timer timer;
    int count = 0;
    public void setTimer(){
		timer = new Timer(1000, new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				// Code to be executed
				count++;
				if (count == ConfigPropertiesFile.TIMEOUT_OPTION_SCREEN/1000) {
					timer.stop();
				    MainScreen leoSpaMainFrame = new MainScreen();
				    leoSpaMainFrame.setVisible(true);
				    mainScreen.dispose();
				}
			}
		});
		timer.setRepeats(true); // Only execute once
		timer.start(); // Go go go!
	}
    
    public void setLayout(){
    	layout = new javax.swing.GroupLayout(mainScreen.getContentPane());
		 mainScreen.getContentPane().setLayout(layout);
		 layout.setHorizontalGroup(
				 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
	            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 815, Short.MAX_VALUE)
	        );
		 layout.setVerticalGroup(
				 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
	            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
	        );
      mainScreen.pack();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {jPanel1 = new javax.swing.JPanel();
    lblMassarium1 = new javax.swing.JLabel();
    btnCancel = new javax.swing.JButton();
    jLayeredPane1 = new javax.swing.JLayeredPane();
    btnFree1 = new javax.swing.JButton();
    jPanel2 = new javax.swing.JPanel();
    jLabel11 = new javax.swing.JLabel();
    jLabel1 = new javax.swing.JLabel();
    lblMassarium2 = new javax.swing.JLabel();
    jLayeredPane5 = new javax.swing.JLayeredPane();
    btnFree2 = new javax.swing.JButton();
    jPanel3 = new javax.swing.JPanel();
    jLabel22 = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();
    lblMassarium3 = new javax.swing.JLabel();
    jLayeredPane6 = new javax.swing.JLayeredPane();
    btnFree3 = new javax.swing.JButton();
    jPanel4 = new javax.swing.JPanel();
    jLabel33 = new javax.swing.JLabel();
    jLabel3 = new javax.swing.JLabel();
    lblMassarium4 = new javax.swing.JLabel();
    jLayeredPane7 = new javax.swing.JLayeredPane();
    btnFree4 = new javax.swing.JButton();
    jPanel5 = new javax.swing.JPanel();
    jLabel44 = new javax.swing.JLabel();
    jLabel4 = new javax.swing.JLabel();

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setMinimumSize(new java.awt.Dimension(800, 1280));

    jPanel1.setMaximumSize(new java.awt.Dimension(800, 1280));
    jPanel1.setMinimumSize(new java.awt.Dimension(800, 1280));
    jPanel1.setOpaque(false);
    jPanel1.setPreferredSize(new java.awt.Dimension(800, 1280));

    Color color = Color.decode(ColorPropertiesFile.Left_Button_Color);
    lblMassarium1.setBackground(color);
    lblMassarium1.setFont(new java.awt.Font("SansSerif", 0, 50)); // NOI18N
    color = Color.decode(ColorPropertiesFile.Left_Button_Text_Color);
    lblMassarium1.setForeground(color);
    lblMassarium1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    lblMassarium1.setOpaque(true);
    try {
		URL imgURL = new File( "./images/3.png" ).toURI().toURL();
		btnCancel.setIcon(new javax.swing.ImageIcon(imgURL)); // NOI18N
	} catch (MalformedURLException e) {
		// TODO Auto-generated catch block
		if(ConfigPropertiesFile.DEBUG_MODE_ON == true){e.printStackTrace();}
	}
    btnCancel.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnCancelActionPerformed(evt);
        }
    });

    color = Color.decode(ColorPropertiesFile.Right_Button_Color);
    btnFree1.setBackground(color);
    btnFree1.setFont(new java.awt.Font("SansSerif", 0, 50)); // NOI18N
    color = Color.decode(ColorPropertiesFile.Right_Button_Text_Color);
    btnFree1.setForeground(color);
    btnFree1.setText("FREI");
    btnFree1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnFree1ActionPerformed(evt);
        }
    });

    color = Color.decode(ColorPropertiesFile.Timer_Button_Color);
    jLabel11.setBackground(color);
    jLabel11.setFont(new java.awt.Font("SansSerif", 0, 25)); // NOI18N
    color = Color.decode(ColorPropertiesFile.Timer_Button_Text_Color);
    jLabel11.setForeground(color);
    jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel11.setText("Restlaufzeit");
    jLabel11.setOpaque(true);
    color = Color.decode(ColorPropertiesFile.Timer_Button_Color);
    jLabel1.setBackground(color);
    jLabel1.setFont(new java.awt.Font("SansSerif", 0, 40)); // NOI18N
    color = Color.decode(ColorPropertiesFile.Timer_Button_Text_Color);
    jLabel1.setForeground(color);
    jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel1.setText("");
    jLabel1.setOpaque(true);
    jLabel1.setPreferredSize(new java.awt.Dimension(151, 60));

    javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
    jPanel2.setLayout(jPanel2Layout);
    jPanel2Layout.setHorizontalGroup(
        jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(jPanel2Layout.createSequentialGroup()
            .addGap(0, 0, Short.MAX_VALUE)
            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                .addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE))
            .addGap(0, 0, 0))
    );
    jPanel2Layout.setVerticalGroup(
        jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(jPanel2Layout.createSequentialGroup()
            .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addGap(0, 0, 0)
            .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addGap(0, 0, 0))
    );

    jLayeredPane1.setLayer(btnFree1, javax.swing.JLayeredPane.DEFAULT_LAYER);
    jLayeredPane1.setLayer(jPanel2, javax.swing.JLayeredPane.DEFAULT_LAYER);

    javax.swing.GroupLayout jLayeredPane1Layout = new javax.swing.GroupLayout(jLayeredPane1);
    jLayeredPane1.setLayout(jLayeredPane1Layout);
    jLayeredPane1Layout.setHorizontalGroup(
        jLayeredPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(jLayeredPane1Layout.createSequentialGroup()
            .addGap(0, 0, 0)
            .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addGap(0, 0, 0)
            .addComponent(btnFree1, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE)
            .addContainerGap())
    );
    jLayeredPane1Layout.setVerticalGroup(
        jLayeredPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(jLayeredPane1Layout.createSequentialGroup()
            .addGroup(jLayeredPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(btnFree1, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGap(0, 0, Short.MAX_VALUE))
    );

    color = Color.decode(ColorPropertiesFile.Left_Button_Color);
    lblMassarium2.setBackground(color);
    lblMassarium2.setFont(new java.awt.Font("SansSerif", 0, 50)); // NOI18N
    color = Color.decode(ColorPropertiesFile.Left_Button_Text_Color);
    lblMassarium2.setForeground(color);
    lblMassarium2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    lblMassarium2.setOpaque(true);

    color = Color.decode(ColorPropertiesFile.Right_Button_Color);
    btnFree2.setBackground(color);
    btnFree2.setFont(new java.awt.Font("SansSerif", 0, 50)); // NOI18N
    color = Color.decode(ColorPropertiesFile.Right_Button_Text_Color);
    btnFree2.setForeground(color);
    btnFree2.setText("FREI");
    btnFree2.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnFree2ActionPerformed(evt);
        }
    });

    color = Color.decode(ColorPropertiesFile.Timer_Button_Color);
    jLabel22.setBackground(color);
    jLabel22.setFont(new java.awt.Font("SansSerif", 0, 25)); // NOI18N
    color = Color.decode(ColorPropertiesFile.Timer_Button_Text_Color);
    jLabel22.setForeground(color);
    jLabel22.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel22.setText("Restlaufzeit");
    jLabel22.setOpaque(true);

    color = Color.decode(ColorPropertiesFile.Timer_Button_Color);
    jLabel2.setBackground(color);
    jLabel2.setFont(new java.awt.Font("SansSerif", 0, 40)); // NOI18N
    color = Color.decode(ColorPropertiesFile.Timer_Button_Text_Color);
    jLabel2.setForeground(color);
    jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel2.setText("");
    jLabel2.setOpaque(true);
    jLabel2.setPreferredSize(new java.awt.Dimension(151, 60));

    javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
    jPanel3.setLayout(jPanel3Layout);
    jPanel3Layout.setHorizontalGroup(
        jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(jPanel3Layout.createSequentialGroup()
            .addGap(0, 0, Short.MAX_VALUE)
            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                .addComponent(jLabel22, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE))
            .addGap(0, 0, 0))
    );
    jPanel3Layout.setVerticalGroup(
        jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(jPanel3Layout.createSequentialGroup()
            .addComponent(jLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addGap(0, 0, 0)
            .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addGap(0, 0, 0))
    );

    jLayeredPane5.setLayer(btnFree2, javax.swing.JLayeredPane.DEFAULT_LAYER);
    jLayeredPane5.setLayer(jPanel3, javax.swing.JLayeredPane.DEFAULT_LAYER);

    javax.swing.GroupLayout jLayeredPane5Layout = new javax.swing.GroupLayout(jLayeredPane5);
    jLayeredPane5.setLayout(jLayeredPane5Layout);
    jLayeredPane5Layout.setHorizontalGroup(
        jLayeredPane5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(jLayeredPane5Layout.createSequentialGroup()
            .addGap(0, 0, 0)
            .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addGap(0, 0, 0)
            .addComponent(btnFree2, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE)
            .addContainerGap())
    );
    jLayeredPane5Layout.setVerticalGroup(
        jLayeredPane5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(jLayeredPane5Layout.createSequentialGroup()
            .addGroup(jLayeredPane5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(btnFree2, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGap(0, 0, Short.MAX_VALUE))
    );

    color = Color.decode(ColorPropertiesFile.Left_Button_Color);
    lblMassarium3.setBackground(color);
    lblMassarium3.setFont(new java.awt.Font("SansSerif", 0, 50)); // NOI18N
    color = Color.decode(ColorPropertiesFile.Left_Button_Text_Color);
    lblMassarium3.setForeground(color);
    lblMassarium3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    lblMassarium3.setOpaque(true);

    color = Color.decode(ColorPropertiesFile.Right_Button_Color);
    btnFree3.setBackground(color);
    btnFree3.setFont(new java.awt.Font("SansSerif", 0, 50)); // NOI18N
    color = Color.decode(ColorPropertiesFile.Right_Button_Text_Color);
    btnFree3.setForeground(color);
    btnFree3.setText("FREI");
    btnFree3.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnFree3ActionPerformed(evt);
        }
    });

    color = Color.decode(ColorPropertiesFile.Timer_Button_Color);
    jLabel33.setBackground(color);
    jLabel33.setFont(new java.awt.Font("SansSerif", 0, 25)); // NOI18N
    color = Color.decode(ColorPropertiesFile.Timer_Button_Text_Color);
    jLabel33.setForeground(color);
    jLabel33.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel33.setText("Restlaufzeit");
    jLabel33.setOpaque(true);

    color = Color.decode(ColorPropertiesFile.Timer_Button_Color);
    jLabel3.setBackground(color);
    jLabel3.setFont(new java.awt.Font("SansSerif", 0, 40)); // NOI18N
    color = Color.decode(ColorPropertiesFile.Timer_Button_Text_Color);
    jLabel3.setForeground(color);
    jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel3.setText("");
    jLabel3.setOpaque(true);
    jLabel3.setPreferredSize(new java.awt.Dimension(151, 60));

    javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
    jPanel4.setLayout(jPanel4Layout);
    jPanel4Layout.setHorizontalGroup(
        jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(jPanel4Layout.createSequentialGroup()
            .addGap(0, 0, Short.MAX_VALUE)
            .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                .addComponent(jLabel33, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE))
            .addGap(0, 0, 0))
    );
    jPanel4Layout.setVerticalGroup(
        jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(jPanel4Layout.createSequentialGroup()
            .addComponent(jLabel33, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addGap(0, 0, 0)
            .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addGap(0, 0, 0))
    );

    jLayeredPane6.setLayer(btnFree3, javax.swing.JLayeredPane.DEFAULT_LAYER);
    jLayeredPane6.setLayer(jPanel4, javax.swing.JLayeredPane.DEFAULT_LAYER);

    javax.swing.GroupLayout jLayeredPane6Layout = new javax.swing.GroupLayout(jLayeredPane6);
    jLayeredPane6.setLayout(jLayeredPane6Layout);
    jLayeredPane6Layout.setHorizontalGroup(
        jLayeredPane6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(jLayeredPane6Layout.createSequentialGroup()
            .addGap(0, 0, 0)
            .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addGap(0, 0, 0)
            .addComponent(btnFree3, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE)
            .addContainerGap())
    );
    jLayeredPane6Layout.setVerticalGroup(
        jLayeredPane6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(jLayeredPane6Layout.createSequentialGroup()
            .addGroup(jLayeredPane6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(btnFree3, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGap(0, 0, Short.MAX_VALUE))
    );

    color = Color.decode(ColorPropertiesFile.Left_Button_Color);
    lblMassarium4.setBackground(color);
    lblMassarium4.setFont(new java.awt.Font("SansSerif", 0, 50)); // NOI18N
    color = Color.decode(ColorPropertiesFile.Left_Button_Text_Color);
    lblMassarium4.setForeground(color);
    lblMassarium4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    lblMassarium4.setOpaque(true);

    color = Color.decode(ColorPropertiesFile.Right_Button_Color);
    btnFree4.setBackground(color);
    btnFree4.setFont(new java.awt.Font("SansSerif", 0, 50)); // NOI18N
    color = Color.decode(ColorPropertiesFile.Right_Button_Text_Color);
    btnFree4.setForeground(color);
    btnFree4.setText("FREI");
    btnFree4.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnFree4ActionPerformed(evt);
        }
    });

    color = Color.decode(ColorPropertiesFile.Timer_Button_Color);
    jLabel44.setBackground(color);
    jLabel44.setFont(new java.awt.Font("SansSerif", 0, 25)); // NOI18N
    color = Color.decode(ColorPropertiesFile.Timer_Button_Text_Color);
    jLabel44.setForeground(color);
    jLabel44.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel44.setText("Restlaufzeit");
    jLabel44.setOpaque(true);

    jLabel4.setBackground(new java.awt.Color(31, 168, 173));
    jLabel4.setFont(new java.awt.Font("SansSerif", 0, 40)); // NOI18N
    jLabel4.setForeground(new java.awt.Color(255, 255, 255));
    jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel4.setText("");
    jLabel4.setOpaque(true);
    jLabel4.setPreferredSize(new java.awt.Dimension(151, 60));

    javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
    jPanel5.setLayout(jPanel5Layout);
    jPanel5Layout.setHorizontalGroup(
        jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(jPanel5Layout.createSequentialGroup()
            .addGap(0, 0, Short.MAX_VALUE)
            .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                .addComponent(jLabel44, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE))
            .addGap(0, 0, 0))
    );
    jPanel5Layout.setVerticalGroup(
        jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(jPanel5Layout.createSequentialGroup()
            .addComponent(jLabel44, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addGap(0, 0, 0)
            .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addGap(0, 0, 0))
    );

    jLayeredPane7.setLayer(btnFree4, javax.swing.JLayeredPane.DEFAULT_LAYER);
    jLayeredPane7.setLayer(jPanel5, javax.swing.JLayeredPane.DEFAULT_LAYER);

    javax.swing.GroupLayout jLayeredPane7Layout = new javax.swing.GroupLayout(jLayeredPane7);
    jLayeredPane7.setLayout(jLayeredPane7Layout);
    jLayeredPane7Layout.setHorizontalGroup(
        jLayeredPane7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(jLayeredPane7Layout.createSequentialGroup()
            .addGap(0, 0, 0)
            .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addGap(0, 0, 0)
            .addComponent(btnFree4, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE)
            .addContainerGap())
    );
    jLayeredPane7Layout.setVerticalGroup(
        jLayeredPane7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(jLayeredPane7Layout.createSequentialGroup()
            .addGroup(jLayeredPane7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(btnFree4, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGap(0, 0, Short.MAX_VALUE))
    );

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(
        jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(jPanel1Layout.createSequentialGroup()
            .addGap(91, 91, 91)
            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup()
                    .addComponent(lblMassarium2, javax.swing.GroupLayout.PREFERRED_SIZE, 430, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, 0)
                    .addComponent(jLayeredPane5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(jPanel1Layout.createSequentialGroup()
                    .addComponent(lblMassarium1, javax.swing.GroupLayout.PREFERRED_SIZE, 430, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, 0)
                    .addComponent(jLayeredPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(jPanel1Layout.createSequentialGroup()
                    .addComponent(lblMassarium3, javax.swing.GroupLayout.PREFERRED_SIZE, 430, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, 0)
                    .addComponent(jLayeredPane6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(jPanel1Layout.createSequentialGroup()
                    .addComponent(lblMassarium4, javax.swing.GroupLayout.PREFERRED_SIZE, 430, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, 0)
                    .addComponent(jLayeredPane7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
            .addContainerGap(85, Short.MAX_VALUE))
        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
            .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(btnCancel, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addGap(184, 184, 184))
    );
    jPanel1Layout.setVerticalGroup(
        jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
            .addGap(212, 212, 212)
            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                .addComponent(lblMassarium1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(jLayeredPane1))
            .addGap(49, 49, 49)
            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                .addComponent(lblMassarium2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(jLayeredPane5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGap(50, 50, 50)
            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                .addComponent(lblMassarium3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(jLayeredPane6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGap(46, 46, 46)
            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                .addComponent(lblMassarium4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(jLayeredPane7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 267, Short.MAX_VALUE)
            .addComponent(btnCancel, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addGap(237, 237, 237))
    );
    btnCancel.setVisible(false);
    }// </editor-fold>       
    
    

    private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {                                          
        if(ConfigPropertiesFile.DEBUG_MODE_ON == true){ System.out.println("in action performed");}
       timer.stop();
       MainScreen leoSpaMainFrame = new MainScreen();
       leoSpaMainFrame.setVisible(true);
       mainScreen.dispose();
//       LeoSpaMainFrame leoSpaMainFrame = new LeoSpaMainFrame(mainScreen,layout);
//       leoSpaMainFrame.setLayout();
    }                                         

    private void btnFree2ActionPerformed(java.awt.event.ActionEvent evt) {                                         
    	Command_0 command_0 = command_0_hash.get("2");
        Util.getUtilInstance().setCommand_0(command_0);
        timer.stop();
        jPanel1.setVisible(false);
        ConfirmationScreen confirmationScreen =  new ConfirmationScreen(mainScreen,layout);
        confirmationScreen.setLayout();
    }                                        

    private void btnFree1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
        Command_0 command_0 = command_0_hash.get("1");
        Util.getUtilInstance().setCommand_0(command_0);
        timer.stop();
        jPanel1.setVisible(false);
        ConfirmationScreen confirmationScreen = new ConfirmationScreen(mainScreen,layout);
        confirmationScreen.setLayout();
    }                                        

    private void btnFree3ActionPerformed(java.awt.event.ActionEvent evt) {                                         
    	 Command_0 command_0 = command_0_hash.get("3");
         Util.getUtilInstance().setCommand_0(command_0);
         timer.stop();
         jPanel1.setVisible(false);
         ConfirmationScreen confirmationScreen = new ConfirmationScreen(mainScreen,layout);
         confirmationScreen.setLayout();

    }                                        

    private void btnFree4ActionPerformed(java.awt.event.ActionEvent evt) {                                         
    	 Command_0 command_0 = command_0_hash.get("4");
         Util.getUtilInstance().setCommand_0(command_0);
         timer.stop();
         jPanel1.setVisible(false);
         ConfirmationScreen confirmationScreen = new ConfirmationScreen(mainScreen,layout);
         confirmationScreen.setLayout();

    }                                        

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(OptionScreen.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(OptionScreen.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(OptionScreen.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(OptionScreen.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
//        new OptionScreen().setVisible(true);
//        /* Create and display the form */
//        java.awt.EventQueue.invokeLater(new Runnable() {
//            public void run() {
//                new OptionScreen().setVisible(true);
//            }
//        });
    }

    // Variables declaration - do not modify                     
    private javax.swing.JButton btnCancel;
    private javax.swing.JButton btnFree1;
    private javax.swing.JButton btnFree2;
    private javax.swing.JButton btnFree3;
    private javax.swing.JButton btnFree4;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel44;
    private javax.swing.JLayeredPane jLayeredPane1;
    private javax.swing.JLayeredPane jLayeredPane5;
    private javax.swing.JLayeredPane jLayeredPane6;
    private javax.swing.JLayeredPane jLayeredPane7;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JLabel lblMassarium1;
    private javax.swing.JLabel lblMassarium2;
    private javax.swing.JLabel lblMassarium3;
    private javax.swing.JLabel lblMassarium4;
    // End of variables declaration                   
}
